from django.db import models
from django.contrib.auth.models import User
from appointments.models import Appointment

# Create your models here.
class case(models.Model):
	patient = models.ForeignKey(User, on_delete=models.CASCADE, related_name='case_patient')
	receptionist = models.ForeignKey(User, on_delete=models.CASCADE, related_name='case_receptionist')
	Appointment = models.ForeignKey(Appointment, on_delete=models.CASCADE, related_name='appointment_case')
	case_result = models.CharField(max_length=512, default=None, null=True, blank=True)
	description = models.CharField(max_length=512, default=None, null=True, blank=True)
	filed_date = models.DateField()
	closed_date = models.DateField(default=None, null=True)

	def __str__(self):
		return self.patient.username + ' having ' + self.description
